<?php
$_doc = array();
$_doc['title'] = L('page_title_profile');
L(include(LANG_PATH.LANG_SET.'/pUser.php'));
?>
<include file="pAdmin:header" />
<h5 class="pagetitle">{%page_title_profile}</h5>
<table class="tabmenu" cellspacing="0">
    <tbody>
        <tr>
            <td class="wedge">&nbsp;</td>
            <td id="tdmyinfo" class="wmenu here"><a href="javascript:tab('myinfo')"><span>{%tab_title_myinfo}</span></a></td>
            <td id="tdeditpwd" class="wmenu"><a href="javascript:tab('editpwd')"><span>{%tab_title_password}</span></a></td>
            <td>&nbsp;</td>
        </tr>
    </tbody>
</table>
<div class="main">
    <ul class="fnc">
        <li><button type="button" class="btn primary" onclick="doAction()">{%action_save}</button></li>
    </ul>
    <form id="myinfoForm" class="validateform" method="post" action="__URL__">
        <input type="hidden" name="editype" value="myinfo"/>
        <input type="hidden" name="a" value="saveProfile"/>
        <table class="ips" id="myinfo">
            <tbody>
                <tr>
                    <th><label for="pk2">{%column_username}</label></th>
                    <td>
                        <label>{$userVo['account']}</label>
                    </td>
                </tr>
                <tr>
                    <th class="essential"><label for="pk4">{%column_realname}</label></th>
                    <td>
                        <input class="validate[required]" type="text" id="pk4" name="realname" size="40" maxlength="32" value="{$userVo['realname']}"/>
                        <p class="hint">{%column_realname_tip}</p>
                    </td>
                </tr>
                <tr>
                    <th><label for="pk5">{%column_mail}</label></th>
                    <td>
                        <input class="validate[email]" type="text" id="pk5" name="email" size="60" maxlength="64" value="{$userVo['email']}"/>
                    </td>
                </tr>
            </tbody>
        </table>
    </form>
    <form id="editpwdForm" class="validateform" name="pwdForm" method="post" action="__URL__">
        <input type="hidden" name="editype" value="pwd"/>
        <input type="hidden" name="a" value="saveProfile"/>
        <table class="ips" id="editpwd" style="display:none">
            <tbody>
                <tr>
                    <th class="essential"><label for="oldpassword">{%column_oldpassword}</label></th>
                    <td><input type="password" class="validate[required]" id="oldpassword" name="oldpassword" maxlength="32"/></td>
                </tr>
                <tr>
                    <th class="essential"><label for="newpass">{%column_newpassword}</label></th>
                    <td><input type="password"  class="validate[required,password]" id="newpass" name="password" /><p class="hint">{%column_password_tip}</p></td>
                </tr>
                <tr>
                    <th class="essential"><label for="renewpass">{%column_renewpassword}</label></th>
                    <td><input type="password" class="validate[required,password]" id="renewpass"/></td>
                </tr>
            </tbody>
        </table>
    </form>
    <script type="text/javascript">
        var oldType = 'myinfo';
        function tab(etype){
            if(oldType!==etype){
                //table change
                $(oldType).setStyle("display","none");
                $(etype).setStyle("display","block");
                //a link class change
                $("td"+oldType).removeClass("here");
                $("td"+etype).addClass("here");
                oldType = etype;
            }
        }
        function doAction(){
            act('save',{form:oldType+'Form',callback:function(){}});
        }
    </script>
    <ul class="fnc">
        <li><button type="button" class="btn primary" onclick="doAction()">{%action_save}</button></li>
    </ul>
</div>